package edu.sias.service;

import edu.sias.dao.UserDao;
import edu.sias.pojo.S_User;

import java.sql.SQLException;

//关于用户操作的业务层
public class UserService {

    UserDao userDao = new UserDao();

    //针对登录的业务层处理
    public boolean loginUser(String name,String psw){
        boolean b = userDao.queryUser(name, psw);
        return b;
    }


    //针对注册的业务层处理
    public void userRegister(S_User s_user){
        System.out.println("s_user = " + s_user);
        userDao.insertUser(s_user);
    }

    //业务层中获取用户信息
    public S_User findUserInfoByName(String name) {
        S_User user= null;
        try {
            user = userDao.queryUserByName(name);
        } catch (SQLException e) {
            e.printStackTrace();
        }
        return user;
    }
}
